/*   
Copyright 2006 - 2010 Intel Corporation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

using OpenSource.UPnP;

namespace OpenSource.UPnP.AV
{
    /// <summary>
    /// Transparent DeviceSide UPnP Service
    /// </summary>
    public class DvConnectionManager : IUPnPService
    {

        // Place your declarations above this line

        #region AutoGenerated Code Section [Do NOT Modify, unless you know what you're doing]
        //{{{{{ Begin Code Block

        private _DvConnectionManager _S;
        public static string URN = "urn:schemas-upnp-org:service:ConnectionManager:1";
        public double VERSION
        {
           get
           {
               return(double.Parse(_S.GetUPnPService().Version));
           }
        }

        public enum Enum_A_ARG_TYPE_Direction
        {
            INPUT,
            OUTPUT,
        }
        public Enum_A_ARG_TYPE_Direction A_ARG_TYPE_Direction
        {
            set
            {
               string v = "";
               switch(value)
               {
                  case Enum_A_ARG_TYPE_Direction.INPUT:
                     v = "Input";
                     break;
                  case Enum_A_ARG_TYPE_Direction.OUTPUT:
                     v = "Output";
                     break;
               }
               _S.SetStateVariable("A_ARG_TYPE_Direction",v);
            }
            get
            {
               Enum_A_ARG_TYPE_Direction RetVal = 0;
               string v = (string)_S.GetStateVariable("A_ARG_TYPE_Direction");
               switch(v)
               {
                  case "Input":
                     RetVal = Enum_A_ARG_TYPE_Direction.INPUT;
                     break;
                  case "Output":
                     RetVal = Enum_A_ARG_TYPE_Direction.OUTPUT;
                     break;
               }
               return(RetVal);
           }
        }
        public enum Enum_A_ARG_TYPE_ConnectionStatus
        {
            OK,
            CONTENTFORMATMISMATCH,
            INSUFFICIENTBANDWIDTH,
            UNRELIABLECHANNEL,
            UNKNOWN,
        }
        public Enum_A_ARG_TYPE_ConnectionStatus A_ARG_TYPE_ConnectionStatus
        {
            set
            {
               string v = "";
               switch(value)
               {
                  case Enum_A_ARG_TYPE_ConnectionStatus.OK:
                     v = "OK";
                     break;
                  case Enum_A_ARG_TYPE_ConnectionStatus.CONTENTFORMATMISMATCH:
                     v = "ContentFormatMismatch";
                     break;
                  case Enum_A_ARG_TYPE_ConnectionStatus.INSUFFICIENTBANDWIDTH:
                     v = "InsufficientBandwidth";
                     break;
                  case Enum_A_ARG_TYPE_ConnectionStatus.UNRELIABLECHANNEL:
                     v = "UnreliableChannel";
                     break;
                  case Enum_A_ARG_TYPE_ConnectionStatus.UNKNOWN:
                     v = "Unknown";
                     break;
               }
               _S.SetStateVariable("A_ARG_TYPE_ConnectionStatus",v);
            }
            get
            {
               Enum_A_ARG_TYPE_ConnectionStatus RetVal = 0;
               string v = (string)_S.GetStateVariable("A_ARG_TYPE_ConnectionStatus");
               switch(v)
               {
                  case "OK":
                     RetVal = Enum_A_ARG_TYPE_ConnectionStatus.OK;
                     break;
                  case "ContentFormatMismatch":
                     RetVal = Enum_A_ARG_TYPE_ConnectionStatus.CONTENTFORMATMISMATCH;
                     break;
                  case "InsufficientBandwidth":
                     RetVal = Enum_A_ARG_TYPE_ConnectionStatus.INSUFFICIENTBANDWIDTH;
                     break;
                  case "UnreliableChannel":
                     RetVal = Enum_A_ARG_TYPE_ConnectionStatus.UNRELIABLECHANNEL;
                     break;
                  case "Unknown":
                     RetVal = Enum_A_ARG_TYPE_ConnectionStatus.UNKNOWN;
                     break;
               }
               return(RetVal);
           }
        }
        static public string Enum_A_ARG_TYPE_Direction_ToString(Enum_A_ARG_TYPE_Direction en)
        {
            string RetVal = "";
            switch(en)
            {
                case Enum_A_ARG_TYPE_Direction.INPUT:
                    RetVal = "Input";
                    break;
                case Enum_A_ARG_TYPE_Direction.OUTPUT:
                    RetVal = "Output";
                    break;
            }
            return(RetVal);
        }
        static public string[] Values_A_ARG_TYPE_Direction
        {
            get
            {
                string[] RetVal = new string[2]{"Output","Input"};
                return(RetVal);
            }
        }
        static public string Enum_A_ARG_TYPE_ConnectionStatus_ToString(Enum_A_ARG_TYPE_ConnectionStatus en)
        {
            string RetVal = "";
            switch(en)
            {
                case Enum_A_ARG_TYPE_ConnectionStatus.OK:
                    RetVal = "OK";
                    break;
                case Enum_A_ARG_TYPE_ConnectionStatus.CONTENTFORMATMISMATCH:
                    RetVal = "ContentFormatMismatch";
                    break;
                case Enum_A_ARG_TYPE_ConnectionStatus.INSUFFICIENTBANDWIDTH:
                    RetVal = "InsufficientBandwidth";
                    break;
                case Enum_A_ARG_TYPE_ConnectionStatus.UNRELIABLECHANNEL:
                    RetVal = "UnreliableChannel";
                    break;
                case Enum_A_ARG_TYPE_ConnectionStatus.UNKNOWN:
                    RetVal = "Unknown";
                    break;
            }
            return(RetVal);
        }
        static public string[] Values_A_ARG_TYPE_ConnectionStatus
        {
            get
            {
                string[] RetVal = new string[5]{"Unknown","UnreliableChannel","InsufficientBandwidth","ContentFormatMismatch","OK"};
                return(RetVal);
            }
        }
        public delegate void OnStateVariableModifiedHandler(DvConnectionManager sender);
        public event OnStateVariableModifiedHandler OnStateVariableModified_A_ARG_TYPE_ProtocolInfo;
        public event OnStateVariableModifiedHandler OnStateVariableModified_A_ARG_TYPE_ConnectionStatus;
        public event OnStateVariableModifiedHandler OnStateVariableModified_A_ARG_TYPE_AVTransportID;
        public event OnStateVariableModifiedHandler OnStateVariableModified_A_ARG_TYPE_RcsID;
        public event OnStateVariableModifiedHandler OnStateVariableModified_A_ARG_TYPE_ConnectionID;
        public event OnStateVariableModifiedHandler OnStateVariableModified_A_ARG_TYPE_ConnectionManager;
        public event OnStateVariableModifiedHandler OnStateVariableModified_SourceProtocolInfo;
        public event OnStateVariableModifiedHandler OnStateVariableModified_SinkProtocolInfo;
        public event OnStateVariableModifiedHandler OnStateVariableModified_A_ARG_TYPE_Direction;
        public event OnStateVariableModifiedHandler OnStateVariableModified_CurrentConnectionIDs;
        public System.String A_ARG_TYPE_ProtocolInfo
        {
            get
            {
               return((System.String)_S.GetStateVariable("A_ARG_TYPE_ProtocolInfo"));
            }
            set
            {
               _S.SetStateVariable("A_ARG_TYPE_ProtocolInfo", value);
            }
        }
        public System.Int32 A_ARG_TYPE_AVTransportID
        {
            get
            {
               return((System.Int32)_S.GetStateVariable("A_ARG_TYPE_AVTransportID"));
            }
            set
            {
               _S.SetStateVariable("A_ARG_TYPE_AVTransportID", value);
            }
        }
        public System.Int32 A_ARG_TYPE_RcsID
        {
            get
            {
               return((System.Int32)_S.GetStateVariable("A_ARG_TYPE_RcsID"));
            }
            set
            {
               _S.SetStateVariable("A_ARG_TYPE_RcsID", value);
            }
        }
        public System.Int32 A_ARG_TYPE_ConnectionID
        {
            get
            {
               return((System.Int32)_S.GetStateVariable("A_ARG_TYPE_ConnectionID"));
            }
            set
            {
               _S.SetStateVariable("A_ARG_TYPE_ConnectionID", value);
            }
        }
        public System.String A_ARG_TYPE_ConnectionManager
        {
            get
            {
               return((System.String)_S.GetStateVariable("A_ARG_TYPE_ConnectionManager"));
            }
            set
            {
               _S.SetStateVariable("A_ARG_TYPE_ConnectionManager", value);
            }
        }
        public System.String Evented_SourceProtocolInfo
        {
            get
            {
               return((System.String)_S.GetStateVariable("SourceProtocolInfo"));
            }
            set
            {
               _S.SetStateVariable("SourceProtocolInfo", value);
            }
        }
        public System.String Evented_SinkProtocolInfo
        {
            get
            {
               return((System.String)_S.GetStateVariable("SinkProtocolInfo"));
            }
            set
            {
               _S.SetStateVariable("SinkProtocolInfo", value);
            }
        }
        public System.String Evented_CurrentConnectionIDs
        {
            get
            {
               return((System.String)_S.GetStateVariable("CurrentConnectionIDs"));
            }
            set
            {
               _S.SetStateVariable("CurrentConnectionIDs", value);
            }
        }
        public UPnPModeratedStateVariable.IAccumulator Accumulator_A_ARG_TYPE_ProtocolInfo
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ProtocolInfo")).Accumulator);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ProtocolInfo")).Accumulator = value;
            }
        }
        public double ModerationDuration_A_ARG_TYPE_ProtocolInfo
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ProtocolInfo")).ModerationPeriod);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ProtocolInfo")).ModerationPeriod = value;
            }
        }
        public UPnPModeratedStateVariable.IAccumulator Accumulator_A_ARG_TYPE_ConnectionStatus
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ConnectionStatus")).Accumulator);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ConnectionStatus")).Accumulator = value;
            }
        }
        public double ModerationDuration_A_ARG_TYPE_ConnectionStatus
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ConnectionStatus")).ModerationPeriod);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ConnectionStatus")).ModerationPeriod = value;
            }
        }
        public UPnPModeratedStateVariable.IAccumulator Accumulator_A_ARG_TYPE_AVTransportID
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_AVTransportID")).Accumulator);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_AVTransportID")).Accumulator = value;
            }
        }
        public double ModerationDuration_A_ARG_TYPE_AVTransportID
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_AVTransportID")).ModerationPeriod);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_AVTransportID")).ModerationPeriod = value;
            }
        }
        public UPnPModeratedStateVariable.IAccumulator Accumulator_A_ARG_TYPE_RcsID
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_RcsID")).Accumulator);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_RcsID")).Accumulator = value;
            }
        }
        public double ModerationDuration_A_ARG_TYPE_RcsID
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_RcsID")).ModerationPeriod);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_RcsID")).ModerationPeriod = value;
            }
        }
        public UPnPModeratedStateVariable.IAccumulator Accumulator_A_ARG_TYPE_ConnectionID
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ConnectionID")).Accumulator);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ConnectionID")).Accumulator = value;
            }
        }
        public double ModerationDuration_A_ARG_TYPE_ConnectionID
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ConnectionID")).ModerationPeriod);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ConnectionID")).ModerationPeriod = value;
            }
        }
        public UPnPModeratedStateVariable.IAccumulator Accumulator_A_ARG_TYPE_ConnectionManager
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ConnectionManager")).Accumulator);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ConnectionManager")).Accumulator = value;
            }
        }
        public double ModerationDuration_A_ARG_TYPE_ConnectionManager
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ConnectionManager")).ModerationPeriod);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ConnectionManager")).ModerationPeriod = value;
            }
        }
        public UPnPModeratedStateVariable.IAccumulator Accumulator_SourceProtocolInfo
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("SourceProtocolInfo")).Accumulator);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("SourceProtocolInfo")).Accumulator = value;
            }
        }
        public double ModerationDuration_SourceProtocolInfo
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("SourceProtocolInfo")).ModerationPeriod);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("SourceProtocolInfo")).ModerationPeriod = value;
            }
        }
        public UPnPModeratedStateVariable.IAccumulator Accumulator_SinkProtocolInfo
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("SinkProtocolInfo")).Accumulator);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("SinkProtocolInfo")).Accumulator = value;
            }
        }
        public double ModerationDuration_SinkProtocolInfo
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("SinkProtocolInfo")).ModerationPeriod);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("SinkProtocolInfo")).ModerationPeriod = value;
            }
        }
        public UPnPModeratedStateVariable.IAccumulator Accumulator_A_ARG_TYPE_Direction
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_Direction")).Accumulator);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_Direction")).Accumulator = value;
            }
        }
        public double ModerationDuration_A_ARG_TYPE_Direction
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_Direction")).ModerationPeriod);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_Direction")).ModerationPeriod = value;
            }
        }
        public UPnPModeratedStateVariable.IAccumulator Accumulator_CurrentConnectionIDs
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("CurrentConnectionIDs")).Accumulator);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("CurrentConnectionIDs")).Accumulator = value;
            }
        }
        public double ModerationDuration_CurrentConnectionIDs
        {
            get
            {
                 return(((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("CurrentConnectionIDs")).ModerationPeriod);
            }
            set
            {
                 ((UPnPModeratedStateVariable)_S.GetUPnPService().GetStateVariableObject("CurrentConnectionIDs")).ModerationPeriod = value;
            }
        }
        public delegate void Delegate_GetCurrentConnectionInfo(System.Int32 ConnectionID, out System.Int32 RcsID, out System.Int32 AVTransportID, out System.String ProtocolInfo, out System.String PeerConnectionManager, out System.Int32 PeerConnectionID, out DvConnectionManager.Enum_A_ARG_TYPE_Direction Direction, out DvConnectionManager.Enum_A_ARG_TYPE_ConnectionStatus Status);
        public delegate void Delegate_PrepareForConnection(System.String RemoteProtocolInfo, System.String PeerConnectionManager, System.Int32 PeerConnectionID, DvConnectionManager.Enum_A_ARG_TYPE_Direction Direction, out System.Int32 ConnectionID, out System.Int32 AVTransportID, out System.Int32 RcsID);
        public delegate void Delegate_ConnectionComplete(System.Int32 ConnectionID);
        public delegate void Delegate_GetProtocolInfo(out System.String Source, out System.String Sink);
        public delegate void Delegate_GetCurrentConnectionIDs(out System.String ConnectionIDs);

        public Delegate_GetCurrentConnectionInfo External_GetCurrentConnectionInfo = null;
        public Delegate_PrepareForConnection External_PrepareForConnection = null;
        public Delegate_ConnectionComplete External_ConnectionComplete = null;
        public Delegate_GetProtocolInfo External_GetProtocolInfo = null;
        public Delegate_GetCurrentConnectionIDs External_GetCurrentConnectionIDs = null;

        public void RemoveStateVariable_A_ARG_TYPE_ProtocolInfo()
        {
            _S.GetUPnPService().RemoveStateVariable(_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ProtocolInfo"));
        }
        public void RemoveStateVariable_A_ARG_TYPE_ConnectionStatus()
        {
            _S.GetUPnPService().RemoveStateVariable(_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ConnectionStatus"));
        }
        public void RemoveStateVariable_A_ARG_TYPE_AVTransportID()
        {
            _S.GetUPnPService().RemoveStateVariable(_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_AVTransportID"));
        }
        public void RemoveStateVariable_A_ARG_TYPE_RcsID()
        {
            _S.GetUPnPService().RemoveStateVariable(_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_RcsID"));
        }
        public void RemoveStateVariable_A_ARG_TYPE_ConnectionID()
        {
            _S.GetUPnPService().RemoveStateVariable(_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ConnectionID"));
        }
        public void RemoveStateVariable_A_ARG_TYPE_ConnectionManager()
        {
            _S.GetUPnPService().RemoveStateVariable(_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ConnectionManager"));
        }
        public void RemoveStateVariable_SourceProtocolInfo()
        {
            _S.GetUPnPService().RemoveStateVariable(_S.GetUPnPService().GetStateVariableObject("SourceProtocolInfo"));
        }
        public void RemoveStateVariable_SinkProtocolInfo()
        {
            _S.GetUPnPService().RemoveStateVariable(_S.GetUPnPService().GetStateVariableObject("SinkProtocolInfo"));
        }
        public void RemoveStateVariable_A_ARG_TYPE_Direction()
        {
            _S.GetUPnPService().RemoveStateVariable(_S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_Direction"));
        }
        public void RemoveStateVariable_CurrentConnectionIDs()
        {
            _S.GetUPnPService().RemoveStateVariable(_S.GetUPnPService().GetStateVariableObject("CurrentConnectionIDs"));
        }
        public void RemoveAction_GetCurrentConnectionInfo()
        {
             _S.GetUPnPService().RemoveMethod("GetCurrentConnectionInfo");
        }
        public void RemoveAction_PrepareForConnection()
        {
             _S.GetUPnPService().RemoveMethod("PrepareForConnection");
        }
        public void RemoveAction_ConnectionComplete()
        {
             _S.GetUPnPService().RemoveMethod("ConnectionComplete");
        }
        public void RemoveAction_GetProtocolInfo()
        {
             _S.GetUPnPService().RemoveMethod("GetProtocolInfo");
        }
        public void RemoveAction_GetCurrentConnectionIDs()
        {
             _S.GetUPnPService().RemoveMethod("GetCurrentConnectionIDs");
        }
        public System.Net.IPEndPoint GetCaller()
        {
             return(_S.GetUPnPService().GetCaller());
        }
        public System.Net.IPEndPoint GetReceiver()
        {
             return(_S.GetUPnPService().GetReceiver());
        }

        private class _DvConnectionManager
        {
            private DvConnectionManager Outer = null;
            private UPnPService S;
            internal _DvConnectionManager(DvConnectionManager n)
            {
                Outer = n;
                S = BuildUPnPService();
            }
            public UPnPService GetUPnPService()
            {
                return(S);
            }
            public void SetStateVariable(string VarName, object VarValue)
            {
               S.SetStateVariable(VarName,VarValue);
            }
            public object GetStateVariable(string VarName)
            {
               return(S.GetStateVariable(VarName));
            }
            protected UPnPService BuildUPnPService()
            {
                UPnPStateVariable[] RetVal = new UPnPStateVariable[10];
                RetVal[0] = new UPnPModeratedStateVariable("A_ARG_TYPE_ProtocolInfo", typeof(System.String), false);
                RetVal[0].AddAssociation("GetCurrentConnectionInfo", "ProtocolInfo");
                RetVal[0].AddAssociation("PrepareForConnection", "RemoteProtocolInfo");
                RetVal[1] = new UPnPModeratedStateVariable("A_ARG_TYPE_ConnectionStatus", typeof(System.String), false);
                RetVal[1].AllowedStringValues = new string[5]{"OK", "ContentFormatMismatch", "InsufficientBandwidth", "UnreliableChannel", "Unknown"};
                RetVal[1].AddAssociation("GetCurrentConnectionInfo", "Status");
                RetVal[2] = new UPnPModeratedStateVariable("A_ARG_TYPE_AVTransportID", typeof(System.Int32), false);
                RetVal[2].AddAssociation("GetCurrentConnectionInfo", "AVTransportID");
                RetVal[2].AddAssociation("PrepareForConnection", "AVTransportID");
                RetVal[3] = new UPnPModeratedStateVariable("A_ARG_TYPE_RcsID", typeof(System.Int32), false);
                RetVal[3].AddAssociation("GetCurrentConnectionInfo", "RcsID");
                RetVal[3].AddAssociation("PrepareForConnection", "RcsID");
                RetVal[4] = new UPnPModeratedStateVariable("A_ARG_TYPE_ConnectionID", typeof(System.Int32), false);
                RetVal[4].AddAssociation("GetCurrentConnectionInfo", "ConnectionID");
                RetVal[4].AddAssociation("GetCurrentConnectionInfo", "PeerConnectionID");
                RetVal[4].AddAssociation("PrepareForConnection", "PeerConnectionID");
                RetVal[4].AddAssociation("PrepareForConnection", "ConnectionID");
                RetVal[4].AddAssociation("ConnectionComplete", "ConnectionID");
                RetVal[5] = new UPnPModeratedStateVariable("A_ARG_TYPE_ConnectionManager", typeof(System.String), false);
                RetVal[5].AddAssociation("GetCurrentConnectionInfo", "PeerConnectionManager");
                RetVal[5].AddAssociation("PrepareForConnection", "PeerConnectionManager");
                RetVal[6] = new UPnPModeratedStateVariable("SourceProtocolInfo", typeof(System.String), true);
                RetVal[6].AddAssociation("GetProtocolInfo", "Source");
                RetVal[7] = new UPnPModeratedStateVariable("SinkProtocolInfo", typeof(System.String), true);
                RetVal[7].AddAssociation("GetProtocolInfo", "Sink");
                RetVal[8] = new UPnPModeratedStateVariable("A_ARG_TYPE_Direction", typeof(System.String), false);
                RetVal[8].AllowedStringValues = new string[2]{"Input", "Output"};
                RetVal[8].AddAssociation("GetCurrentConnectionInfo", "Direction");
                RetVal[8].AddAssociation("PrepareForConnection", "Direction");
                RetVal[9] = new UPnPModeratedStateVariable("CurrentConnectionIDs", typeof(System.String), true);
                RetVal[9].AddAssociation("GetCurrentConnectionIDs", "ConnectionIDs");

                UPnPService S = new UPnPService(1, "urn:schemas-upnp-org:service:ConnectionManager", "urn:schemas-upnp-org:service:ConnectionManager:1", true, this);
                for(int i=0;i<RetVal.Length;++i)
                {
                   S.AddStateVariable(RetVal[i]);
                }
                S.AddMethod("GetCurrentConnectionInfo");
                S.AddMethod("PrepareForConnection");
                S.AddMethod("ConnectionComplete");
                S.AddMethod("GetProtocolInfo");
                S.AddMethod("GetCurrentConnectionIDs");
                return(S);
            }

            public void GetCurrentConnectionInfo(System.Int32 ConnectionID, out System.Int32 RcsID, out System.Int32 AVTransportID, out System.String ProtocolInfo, out System.String PeerConnectionManager, out System.Int32 PeerConnectionID, out System.String Direction, out System.String Status)
            {
                Enum_A_ARG_TYPE_Direction e_Direction;
                Enum_A_ARG_TYPE_ConnectionStatus e_Status;
                if(Outer.External_GetCurrentConnectionInfo != null)
                {
                    Outer.External_GetCurrentConnectionInfo(ConnectionID, out RcsID, out AVTransportID, out ProtocolInfo, out PeerConnectionManager, out PeerConnectionID, out e_Direction, out e_Status);
                }
                else
                {
                    Sink_GetCurrentConnectionInfo(ConnectionID, out RcsID, out AVTransportID, out ProtocolInfo, out PeerConnectionManager, out PeerConnectionID, out e_Direction, out e_Status);
                }
                switch(e_Direction)
                {
                    case Enum_A_ARG_TYPE_Direction.INPUT:
                        Direction = "Input";
                        break;
                    case Enum_A_ARG_TYPE_Direction.OUTPUT:
                        Direction = "Output";
                        break;
                    default:
                        Direction = "";
                        break;
                }
                switch(e_Status)
                {
                    case Enum_A_ARG_TYPE_ConnectionStatus.OK:
                        Status = "OK";
                        break;
                    case Enum_A_ARG_TYPE_ConnectionStatus.CONTENTFORMATMISMATCH:
                        Status = "ContentFormatMismatch";
                        break;
                    case Enum_A_ARG_TYPE_ConnectionStatus.INSUFFICIENTBANDWIDTH:
                        Status = "InsufficientBandwidth";
                        break;
                    case Enum_A_ARG_TYPE_ConnectionStatus.UNRELIABLECHANNEL:
                        Status = "UnreliableChannel";
                        break;
                    case Enum_A_ARG_TYPE_ConnectionStatus.UNKNOWN:
                        Status = "Unknown";
                        break;
                    default:
                        Status = "";
                        break;
                }
            }
            public void PrepareForConnection(System.String RemoteProtocolInfo, System.String PeerConnectionManager, System.Int32 PeerConnectionID, System.String Direction, out System.Int32 ConnectionID, out System.Int32 AVTransportID, out System.Int32 RcsID)
            {
                Enum_A_ARG_TYPE_Direction e_Direction;
                switch(Direction)
                {
                    case "Input":
                        e_Direction = Enum_A_ARG_TYPE_Direction.INPUT;
                        break;
                    case "Output":
                        e_Direction = Enum_A_ARG_TYPE_Direction.OUTPUT;
                        break;
                    default:
                        e_Direction = 0;
                        break;
                }
                if(Outer.External_PrepareForConnection != null)
                {
                    Outer.External_PrepareForConnection(RemoteProtocolInfo, PeerConnectionManager, PeerConnectionID, e_Direction, out ConnectionID, out AVTransportID, out RcsID);
                }
                else
                {
                    Sink_PrepareForConnection(RemoteProtocolInfo, PeerConnectionManager, PeerConnectionID, e_Direction, out ConnectionID, out AVTransportID, out RcsID);
                }
            }
            public void ConnectionComplete(System.Int32 ConnectionID)
            {
                if(Outer.External_ConnectionComplete != null)
                {
                    Outer.External_ConnectionComplete(ConnectionID);
                }
                else
                {
                    Sink_ConnectionComplete(ConnectionID);
                }
            }
            public void GetProtocolInfo(out System.String Source, out System.String Sink)
            {
                if(Outer.External_GetProtocolInfo != null)
                {
                    Outer.External_GetProtocolInfo(out Source, out Sink);
                }
                else
                {
                    Sink_GetProtocolInfo(out Source, out Sink);
                }
            }
            public void GetCurrentConnectionIDs(out System.String ConnectionIDs)
            {
                if(Outer.External_GetCurrentConnectionIDs != null)
                {
                    Outer.External_GetCurrentConnectionIDs(out ConnectionIDs);
                }
                else
                {
                    Sink_GetCurrentConnectionIDs(out ConnectionIDs);
                }
            }

            public Delegate_GetCurrentConnectionInfo Sink_GetCurrentConnectionInfo;
            public Delegate_PrepareForConnection Sink_PrepareForConnection;
            public Delegate_ConnectionComplete Sink_ConnectionComplete;
            public Delegate_GetProtocolInfo Sink_GetProtocolInfo;
            public Delegate_GetCurrentConnectionIDs Sink_GetCurrentConnectionIDs;
        }
        public DvConnectionManager()
        {
            _S = new _DvConnectionManager(this);
            _S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ProtocolInfo").OnModified += new UPnPStateVariable.ModifiedHandler(OnModifiedSink_A_ARG_TYPE_ProtocolInfo);
            _S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ConnectionStatus").OnModified += new UPnPStateVariable.ModifiedHandler(OnModifiedSink_A_ARG_TYPE_ConnectionStatus);
            _S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_AVTransportID").OnModified += new UPnPStateVariable.ModifiedHandler(OnModifiedSink_A_ARG_TYPE_AVTransportID);
            _S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_RcsID").OnModified += new UPnPStateVariable.ModifiedHandler(OnModifiedSink_A_ARG_TYPE_RcsID);
            _S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ConnectionID").OnModified += new UPnPStateVariable.ModifiedHandler(OnModifiedSink_A_ARG_TYPE_ConnectionID);
            _S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_ConnectionManager").OnModified += new UPnPStateVariable.ModifiedHandler(OnModifiedSink_A_ARG_TYPE_ConnectionManager);
            _S.GetUPnPService().GetStateVariableObject("SourceProtocolInfo").OnModified += new UPnPStateVariable.ModifiedHandler(OnModifiedSink_SourceProtocolInfo);
            _S.GetUPnPService().GetStateVariableObject("SinkProtocolInfo").OnModified += new UPnPStateVariable.ModifiedHandler(OnModifiedSink_SinkProtocolInfo);
            _S.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_Direction").OnModified += new UPnPStateVariable.ModifiedHandler(OnModifiedSink_A_ARG_TYPE_Direction);
            _S.GetUPnPService().GetStateVariableObject("CurrentConnectionIDs").OnModified += new UPnPStateVariable.ModifiedHandler(OnModifiedSink_CurrentConnectionIDs);
            _S.Sink_GetCurrentConnectionInfo = new Delegate_GetCurrentConnectionInfo(GetCurrentConnectionInfo);
            _S.Sink_PrepareForConnection = new Delegate_PrepareForConnection(PrepareForConnection);
            _S.Sink_ConnectionComplete = new Delegate_ConnectionComplete(ConnectionComplete);
            _S.Sink_GetProtocolInfo = new Delegate_GetProtocolInfo(GetProtocolInfo);
            _S.Sink_GetCurrentConnectionIDs = new Delegate_GetCurrentConnectionIDs(GetCurrentConnectionIDs);
        }
        public DvConnectionManager(string ID):this()
        {
            _S.GetUPnPService().ServiceID = ID;
        }
        public UPnPService GetUPnPService()
        {
            return(_S.GetUPnPService());
        }
        private void OnModifiedSink_A_ARG_TYPE_ProtocolInfo(UPnPStateVariable sender, object NewValue)
        {
            if(OnStateVariableModified_A_ARG_TYPE_ProtocolInfo != null) OnStateVariableModified_A_ARG_TYPE_ProtocolInfo(this);
        }
        private void OnModifiedSink_A_ARG_TYPE_ConnectionStatus(UPnPStateVariable sender, object NewValue)
        {
            if(OnStateVariableModified_A_ARG_TYPE_ConnectionStatus != null) OnStateVariableModified_A_ARG_TYPE_ConnectionStatus(this);
        }
        private void OnModifiedSink_A_ARG_TYPE_AVTransportID(UPnPStateVariable sender, object NewValue)
        {
            if(OnStateVariableModified_A_ARG_TYPE_AVTransportID != null) OnStateVariableModified_A_ARG_TYPE_AVTransportID(this);
        }
        private void OnModifiedSink_A_ARG_TYPE_RcsID(UPnPStateVariable sender, object NewValue)
        {
            if(OnStateVariableModified_A_ARG_TYPE_RcsID != null) OnStateVariableModified_A_ARG_TYPE_RcsID(this);
        }
        private void OnModifiedSink_A_ARG_TYPE_ConnectionID(UPnPStateVariable sender, object NewValue)
        {
            if(OnStateVariableModified_A_ARG_TYPE_ConnectionID != null) OnStateVariableModified_A_ARG_TYPE_ConnectionID(this);
        }
        private void OnModifiedSink_A_ARG_TYPE_ConnectionManager(UPnPStateVariable sender, object NewValue)
        {
            if(OnStateVariableModified_A_ARG_TYPE_ConnectionManager != null) OnStateVariableModified_A_ARG_TYPE_ConnectionManager(this);
        }
        private void OnModifiedSink_SourceProtocolInfo(UPnPStateVariable sender, object NewValue)
        {
            if(OnStateVariableModified_SourceProtocolInfo != null) OnStateVariableModified_SourceProtocolInfo(this);
        }
        private void OnModifiedSink_SinkProtocolInfo(UPnPStateVariable sender, object NewValue)
        {
            if(OnStateVariableModified_SinkProtocolInfo != null) OnStateVariableModified_SinkProtocolInfo(this);
        }
        private void OnModifiedSink_A_ARG_TYPE_Direction(UPnPStateVariable sender, object NewValue)
        {
            if(OnStateVariableModified_A_ARG_TYPE_Direction != null) OnStateVariableModified_A_ARG_TYPE_Direction(this);
        }
        private void OnModifiedSink_CurrentConnectionIDs(UPnPStateVariable sender, object NewValue)
        {
            if(OnStateVariableModified_CurrentConnectionIDs != null) OnStateVariableModified_CurrentConnectionIDs(this);
        }
        //}}}}} End of Code Block

        #endregion

        /// <summary>
        /// Action: GetCurrentConnectionInfo
        /// </summary>
        /// <param name="ConnectionID">Associated State Variable: A_ARG_TYPE_ConnectionID</param>
        /// <param name="RcsID">Associated State Variable: A_ARG_TYPE_RcsID</param>
        /// <param name="AVTransportID">Associated State Variable: A_ARG_TYPE_AVTransportID</param>
        /// <param name="ProtocolInfo">Associated State Variable: A_ARG_TYPE_ProtocolInfo</param>
        /// <param name="PeerConnectionManager">Associated State Variable: A_ARG_TYPE_ConnectionManager</param>
        /// <param name="PeerConnectionID">Associated State Variable: A_ARG_TYPE_ConnectionID</param>
        /// <param name="Direction">Associated State Variable: A_ARG_TYPE_Direction</param>
        /// <param name="Status">Associated State Variable: A_ARG_TYPE_ConnectionStatus</param>
        public void GetCurrentConnectionInfo(System.Int32 ConnectionID, out System.Int32 RcsID, out System.Int32 AVTransportID, out System.String ProtocolInfo, out System.String PeerConnectionManager, out System.Int32 PeerConnectionID, out Enum_A_ARG_TYPE_Direction Direction, out Enum_A_ARG_TYPE_ConnectionStatus Status)
        {
            //ToDo: Add Your implementation here, and remove exception
            throw(new UPnPCustomException(800,"This method has not been completely implemented..."));
        }
        /// <summary>
        /// Action: PrepareForConnection
        /// </summary>
        /// <param name="RemoteProtocolInfo">Associated State Variable: A_ARG_TYPE_ProtocolInfo</param>
        /// <param name="PeerConnectionManager">Associated State Variable: A_ARG_TYPE_ConnectionManager</param>
        /// <param name="PeerConnectionID">Associated State Variable: A_ARG_TYPE_ConnectionID</param>
        /// <param name="Direction">Associated State Variable: A_ARG_TYPE_Direction</param>
        /// <param name="ConnectionID">Associated State Variable: A_ARG_TYPE_ConnectionID</param>
        /// <param name="AVTransportID">Associated State Variable: A_ARG_TYPE_AVTransportID</param>
        /// <param name="RcsID">Associated State Variable: A_ARG_TYPE_RcsID</param>
        public void PrepareForConnection(System.String RemoteProtocolInfo, System.String PeerConnectionManager, System.Int32 PeerConnectionID, Enum_A_ARG_TYPE_Direction Direction, out System.Int32 ConnectionID, out System.Int32 AVTransportID, out System.Int32 RcsID)
        {
            //ToDo: Add Your implementation here, and remove exception
            throw(new UPnPCustomException(800,"This method has not been completely implemented..."));
        }
        /// <summary>
        /// Action: ConnectionComplete
        /// </summary>
        /// <param name="ConnectionID">Associated State Variable: A_ARG_TYPE_ConnectionID</param>
        public void ConnectionComplete(System.Int32 ConnectionID)
        {
            //ToDo: Add Your implementation here, and remove exception
            throw(new UPnPCustomException(800,"This method has not been completely implemented..."));
        }
        /// <summary>
        /// Action: GetProtocolInfo
        /// </summary>
        /// <param name="Source">Associated State Variable: SourceProtocolInfo</param>
        /// <param name="Sink">Associated State Variable: SinkProtocolInfo</param>
        public void GetProtocolInfo(out System.String Source, out System.String Sink)
        {
            //ToDo: Add Your implementation here, and remove exception
            throw(new UPnPCustomException(800,"This method has not been completely implemented..."));
        }
        /// <summary>
        /// Action: GetCurrentConnectionIDs
        /// </summary>
        /// <param name="ConnectionIDs">Associated State Variable: CurrentConnectionIDs</param>
        public void GetCurrentConnectionIDs(out System.String ConnectionIDs)
        {
            //ToDo: Add Your implementation here, and remove exception
            throw(new UPnPCustomException(800,"This method has not been completely implemented..."));
        }
    }
}